{#
 * ---------------------------------------------------------------------
 * GLPI - Gestionnaire Libre de Parc Informatique
 * Copyright (C) 2015-2018 Teclib' and contributors.
 *
 * http://glpi-project.org
 *
 * based on GLPI - Gestionnaire Libre de Parc Informatique
 * Copyright (C) 2003-2014 by the INDEPNET Development Team.
 *
 * ---------------------------------------------------------------------
 *
 * LICENSE
 *
 * This file is part of GLPI.
 *
 * GLPI is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * GLPI is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GLPI. If not, see <http://www.gnu.org/licenses/>.
 * ---------------------------------------------------------------------
 #}
{% extends "glpi_page.twig" %}
{% set item = false %}

{% block header %}
   {{ parent() }}
{% endblock %}

{% block content %}
<div class="container content">
   <div style="background-color:white;">
      {% include "elements/form.twig" with {'glpi_form': glpi_form} %}

   {% block dd_content %}
      <div class="container row">
      {% for label, dp in glpi_form.elements.devices.values %}
         <div class="col-xs-12  col-sm-6 col-md-3">
            <div class="card">
               <div class="card-header with-border">
                  <h3>{{ label }}</h3>
                  <div class="btn-group pull-right">
                     <button type="button" class="btn btn-box-tool" data-widget="collapse">
                        <i class="fa fa-minus"></i>
                     </button>
                  </div>
               </div>
               <div class="card-body">
                  <dl>
         {% for key, value in dp %}
            {% set dd_item = getitem(key) %}
                     <dd>
                        <a href="{{ path_for('list', {'itemtype': key})}}">
                           {{ value }}
                        </a>
                     </dd>
         {% endfor %}
                  </dl>
               </div>
            </div>
         </div>
      {% endfor %}
      </div>
   {% endblock %}

   </div>
</div>
{% endblock %}

{% block javascripts %}
   {{ parent() }}
   <script type="text/javascript">
      var onDdListChange = function (elt, event) {
         var _value = elt.val();
         if (_value != 0) {
            window.location.href = '{{ path_for('list', {'itemtype': 'PLACEBO'}) }}'.replace(/PLACEBO/, _value);
         } else {
            window.location.href = '{{ path_for('devices') }}';
         }
      };
   </script>
{% endblock %}
